package com.probiz.estore.common.model.inventory.base;

import com.probiz.estore.common.model.inventory.Inventory;
import com.probiz.estore.common.model.order.SalesOrder;
import com.probiz.estore.common.model.product.ProductSku;
import com.probiz.estore.core.model.BaseObject;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import java.io.Serializable;
import java.util.Date;

/**
 * InventoryAudit Base Java Bean, base class for the model, mapped directly to database table
 * <p/>
 * Avoid changing this file if not necessary, will be overwritten.
 */
public class InventoryAuditTbl extends BaseObject implements Serializable {

    protected Integer inventoryAuditId;
    protected Integer quantity;
    protected String reason;
    protected String comment;
    protected String eventHandler;
    protected Short eventType;
    protected Date createTime;
    protected Integer preQuantityOnHand;
    protected Integer preAllocatedQuantity;
    protected Integer postQuantityOnHand;
    protected Integer postAllocatedQuantity;
    protected Inventory inventory;
    protected ProductSku productSku;
    protected SalesOrder salesOrder;

    /**
     * Default Empty Constructor for class InventoryAudit
     */
    public InventoryAuditTbl() {
        super();
    }

    /**
     * Default Key Fields Constructor for class InventoryAudit
     *  @param in_inventoryAuditId 明细id
     */
    public InventoryAuditTbl(Integer in_inventoryAuditId) {
        this.setInventoryAuditId(in_inventoryAuditId);
    }


    public Inventory getInventory() {
        return inventory;
    }

    public void setInventory(Inventory inventory) {
        this.inventory = inventory;
    }

    /**
     * * @return Integer
     *
     * @hibernate.id column="inventoryAuditId" type="java.lang.Integer" generator-class="native"
     */
    public Integer getInventoryAuditId() {
        return this.inventoryAuditId;
    }

    /**
     * Set the inventoryAuditId
     */
    public void setInventoryAuditId(Integer aValue) {
        this.inventoryAuditId = aValue;
    }

    /**
     * * @return Integer
     */
    public Integer getInventoryId() {
        return this.getInventory() == null ? null : this.getInventory().getInventoryId();
    }

    /**
     * Set the inventoryId
     */
    public void setInventoryId(Integer aValue) {
        if (aValue == null) {
            inventory = null;
        } else {
            inventory = new com.probiz.estore.common.model.inventory.Inventory(aValue);
            inventory.setVersion(Integer.valueOf(0));//set a version to cheat hibernate only
        }
    }

    /**
     * 操作数量	 * @return Integer
     *
     * @hibernate.property column="quantity" type="java.lang.Integer" length="10" not-null="true" unique="false"
     */
    public Integer getQuantity() {
        return this.quantity;
    }

    /**
     * Set the quantity
     *
     * @spring.validator type="required"
     */
    public void setQuantity(Integer aValue) {
        this.quantity = aValue;
    }


    /**
     * 操作理由
     * 进货、退货、损坏、盗窃	 * @return String
     *
     * @hibernate.property column="reason" type="java.lang.String" length="128" not-null="false" unique="false"
     */
    public String getReason() {
        return this.reason;
    }

    /**
     * Set the reason
     */
    public void setReason(String aValue) {
        this.reason = aValue;
    }

    /**
     * 备注	 * @return String
     *
     * @hibernate.property column="comment" type="java.lang.String" length="1024" not-null="false" unique="false"
     */
    public String getComment() {
        return this.comment;
    }

    /**
     * Set the comment
     */
    public void setComment(String aValue) {
        this.comment = aValue;
    }

    /**
     * 操作者，可能是前台、后台管理员、系统	 * @return String
     *
     * @hibernate.property column="eventHandler" type="java.lang.String" length="128" not-null="true" unique="false"
     */
    public String getEventHandler() {
        return this.eventHandler;
    }

    /**
     * Set the eventHandler
     *
     * @spring.validator type="required"
     */
    public void setEventHandler(String aValue) {
        this.eventHandler = aValue;
    }

    public Short getEventType() {
		return eventType;
	}

	public void setEventType(Short eventType) {
		this.eventType = eventType;
	}

	/**
     * * @return Date
     *
     * @hibernate.property column="createTime" type="Date" length="0" not-null="true" unique="false"
     */
    public Date getCreateTime() {
        return this.createTime;
    }

    /**
     * Set the createTime
     *
     * @spring.validator type="required"
     */
    public void setCreateTime(Date aValue) {
        this.createTime = aValue;
    }

    /**
     * @see java.lang.Object#equals(Object)
     */
    public boolean equals(Object object) {
        if (!(object instanceof InventoryAuditTbl)) {
            return false;
        }
        InventoryAuditTbl rhs = (InventoryAuditTbl) object;
        return new EqualsBuilder()
                .append(this.inventoryAuditId, rhs.inventoryAuditId)
                .append(this.quantity, rhs.quantity)
                .append(this.reason, rhs.reason)
                .append(this.comment, rhs.comment)
                .append(this.eventHandler, rhs.eventHandler)
                .append(this.createTime, rhs.createTime)
                .isEquals();
    }

    /**
     * @see java.lang.Object#hashCode()
     */
    public int hashCode() {
        return new HashCodeBuilder(-82280557, -700257973)
                .append(this.inventoryAuditId)
                .append(this.quantity)
                .append(this.reason)
                .append(this.comment)
                .append(this.eventHandler)
                .append(this.createTime)
                .toHashCode();
    }

    /**
     * @see java.lang.Object#toString()
     */
    public String toString() {
        return new ToStringBuilder(this)
                .append("inventoryAuditId", this.inventoryAuditId)
                .append("quantity", this.quantity)
                .append("reason", this.reason)
                .append("comment", this.comment)
                .append("eventHandler", this.eventHandler)
                .append("createTime", this.createTime)
                .toString();
    }

    /**
     * Return the name of the first key column
     */
    public String getFirstKeyColumnName() {
        return "inventoryAuditId";
    }

    /**
     * Return the Id (pk) of the entity, must be Integer
     */
    public Integer getId() {
        return inventoryAuditId;
    }

    public com.probiz.estore.common.model.order.SalesOrder getSalesOrder() {
        return salesOrder;
    }

    public void setSalesOrder(
            com.probiz.estore.common.model.order.SalesOrder salesOrder) {
        this.salesOrder = salesOrder;
    }

    /**
     * * @return Integer
     */
    public Integer getSalesOrderId() {
        return this.getSalesOrder() == null ? null : this.getSalesOrder().getSalesOrderId();
    }

    /**
     * Set the inventoryId
     */
    public void setSalesOrderId(Integer aValue) {
        if (aValue == null) {
            salesOrder = null;
        } else {
            salesOrder = new com.probiz.estore.common.model.order.SalesOrder(aValue);
            salesOrder.setVersion(Integer.valueOf(0));//set a version to cheat hibernate only
        }
    }

    public com.probiz.estore.common.model.product.ProductSku getProductSku() {
        return productSku;
    }

    public void setProductSku(
            com.probiz.estore.common.model.product.ProductSku in_productSku) {
        this.productSku = in_productSku;
    }

    /**
     * *
     *
     * @return Integer
     */
    public Integer getProductSkuId() {
        return this.getProductSku() == null ? null : this.getProductSku()
                .getProductSkuId();
    }

    /**
     * Set the productSkuId
     */
    public void setProductSkuId(Integer aValue) {
        if (aValue == null) {
            productSku = null;
        } else {
            productSku = new com.probiz.estore.common.model.product.ProductSku(
                    aValue);
            productSku.setVersion(Integer.valueOf(0));// set a version to cheat
            // hibernate only
        }
    }

	public Integer getPreQuantityOnHand() {
		return preQuantityOnHand;
	}

	public void setPreQuantityOnHand(Integer preQuantityOnHand) {
		this.preQuantityOnHand = preQuantityOnHand;
	}

	public Integer getPreAllocatedQuantity() {
		return preAllocatedQuantity;
	}

	public void setPreAllocatedQuantity(Integer preAllocatedQuantity) {
		this.preAllocatedQuantity = preAllocatedQuantity;
	}

	public Integer getPostQuantityOnHand() {
		return postQuantityOnHand;
	}

	public void setPostQuantityOnHand(Integer postQuantityOnHand) {
		this.postQuantityOnHand = postQuantityOnHand;
	}

	public Integer getPostAllocatedQuantity() {
		return postAllocatedQuantity;
	}

	public void setPostAllocatedQuantity(Integer postAllocatedQuantity) {
		this.postAllocatedQuantity = postAllocatedQuantity;
	}

   

}